home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CDsupport / IDer / Routines / ErrorHandler.s < prev    next >
Text File  |  1997-02-18  |  2KB  |  41 lines

  1. ErrorHandler:    Tst.W    _ErrorCode        ;no errors, then we are outta here
  2.     Beq.S    .NoErrors
  3.  
  4.     Moveq    #0,D0
  5.     Move.W    _ErrorCode(PC),D0    ;get the error code returned from main code
  6.  
  7.     Cmp.W    #1,D0        ;the ReadArgs error uses 1 instead of 0
  8.     Bne.S    .NotRDA        ;to avoid being mistaken for no error
  9.     Subq    #1,D0
  10.  
  11. .NotRDA    Move.L    #ErrorHeader,D1        ;start of the error message
  12.     Lea    ErrTable(PC),A0        ;table of error messages
  13.     Add.L    D0,A0        ;move a certain amount into the table
  14.     Move.L    A0,D2        ;get the address of the message we need
  15.  
  16. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  17. .PrintError    Tst.L    _WBMessage        ;if we are running from workbench
  18.     Bne.S    .FromWB        ;chances are, we don't have a CON: available
  19.  
  20.     CALL    VPrintf,DOS        ;type the text to the con window
  21. .NoErrors    Rts
  22.  
  23. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. .FromWB    Clr.B    ErrorHeader+25        ;we don't need an extra CR in the requestor
  25.     Moveq    #'\n',D0        ;CR ASCII code
  26.     Move.B    D0,ErrProcessing+10    ;The following lines break up the text
  27.     Move.B    D0,ErrOpening+7        ;that appears in the error requestors.
  28.     Move.B    D0,ErrReading+7        ;This is so the lines are not too long
  29.     Move.B    D0,ErrMemory+17        ;if a long filename is provided, or
  30.     Move.B    D0,ErrASLReq+10        ;if the user is using a small screen
  31.     Move.B    D0,ErrEndOfCfg+7
  32.     
  33.     Sub.L    A0,A0        ;window to open on
  34.     Lea    _esReq(PC),A1        ;easyrequest structure
  35.     Sub.L    A2,A2        ;no custom IDCMP requests
  36.     Move.L    D1,es_TextFormat(A1)    ;requestor text
  37.     Move.L    #Ok,es_GadgetFormat(A1)    ;requestor gadget
  38.     Move.L    D2,A3        ;requestor text arguments
  39.     CALL    EasyRequestArgs,INTUI    ;bring up the requestor.
  40.     Rts
  41.